package August;

import java.util.*;

public class Day0830 {
//    public static void main(String[] args) {
//        Scanner scanner = new Scanner(System.in);
//        while (scanner.hasNext()){
//            String a = scanner.next();
//            String b = scanner.next();
//            HashMap<Character,Integer> hashMap = new HashMap<>();
//            HashMap<Character,Integer> hashMap1 = new HashMap<>();
//            for (int i = 0; i < a.length(); i++) {
//                char temp = a.charAt(i);
//
//                if (!hashMap.containsKey(temp)){
//                    hashMap.put(temp,hashMap.get(temp)+1);
//                }else {
//                    hashMap.put(temp,1);
//                }
//            }
//
//            for (int i = 0; i < b.length(); i++) {
//                char temp = b.charAt(i);
//
//                if (!hashMap1.containsKey(temp)){
//                    hashMap1.put(temp,hashMap1.get(temp)+1);
//                }else {
//                    hashMap1.put(temp,1);
//                }
//            }
//            for (Map.Entry<Character,Integer> temp : hashMap1.entrySet()) {
//                Character key = temp.getKey();
//                Integer val = temp.getValue();
//
//                if (hashMap.containsKey(key)){
//                    if (hashMap.get(key) < val)
//                        System.out.println("No");
//                }else
//                    System.out.println("Yes");
//            }
//        }
//    }




    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            String[] dist = new String[n];
            for (int i = 0; i < n; i++) {
                dist[i] = in.next();
            }
            String xWord = in.next();
            char[] xWordArr = xWord.toCharArray();
            Arrays.sort(xWordArr);

            int k = in.nextInt();
            List<String> broWords = new ArrayList<>();


            for (String word : dist) {
                if (xWord.length() == word.length() && !xWord.equals(word)) {
                    char[] tmpWordArr = word.toCharArray();
                    Arrays.sort(tmpWordArr);
                    if (Arrays.equals(tmpWordArr, xWordArr)) {
                        broWords.add(word);
                    }
                }
            }

            System.out.println(broWords.size());
            if (broWords.size() >= k) {
                Collections.sort(broWords);
                System.out.println(broWords.get(k - 1));
            }
        }
    }

}
